<?php

namespace plugin\muadmin\app\admin\controller;

use plugin\muadmin\app\common\base\BaseAdminController;
use plugin\muadmin\app\common\core\Util;
use think\facade\Db;
use Workerman\Worker;

class Dashboard extends BaseAdminController
{
    public function index()
    {
        $sqlversion = Db::query("select VERSION() as version");
        $res = [
            [
                'name'=>'Workerman版本',
                'value'=> Worker::VERSION
            ],
            [
                'name'=>'Webman版本',
                'value'=> Util::getPackageVersion('workerman/webman-framework')
            ],
            [
                'name'=>'PHP版本',
                'value'=> PHP_VERSION
            ],
            [
                'name'=>'操作系统',
                'value'=> PHP_OS
            ],
            [
                'name'=>'运行环境',
                'value'=> $_SERVER['SERVER_SOFTWARE']
            ],
            [
                'name'=>'服务器时间',
                'value'=> date('Y-m-d H:i:s')
            ],
            [
                'name'=>'数据库版本',
                'value'=> $sqlversion[0]['version']??'unknown'
            ]
        ];
        $this->assignConfig('sysdata',$res);
        return $this->fetch();
    }
}